package com.cxyzy.objectboxkotlindemo

import android.app.Application
import com.github.salomonbrys.kodein.*
import io.objectbox.Box
import io.objectbox.BoxStore

class App : Application(), KodeinAware {
    lateinit var boxStore: BoxStore
        private set
    override val kodein by Kodein.lazy {
        bind<Box<User>>() with provider { boxStore.boxFor(User::class.java) }
    }

    override fun onCreate() {
        super.onCreate()
        boxStore = MyObjectBox.builder().androidContext(applicationContext).build()
    }
}